package com.lw.behavioral.command;

import com.lw.behavioral.command.ord.Order;

import java.util.ArrayList;
import java.util.List;

//中转站（股票平台），它来帮我们执行买卖单的命令
public class Broker {
   private List<Order> orderList = new ArrayList<Order>();

   //选择平台的命令
   public void takeOrder(Order order){
      orderList.add(order);      
   }

   //选择，然后下单
   public void placeOrders(){
      for (Order order : orderList) {
         order.execute();
      }
      orderList.clear();
   }
}